<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue.js - v-on</title>
</head>
<body>
    <div id="app">
        <!-- v-on/@:监听事件=内联语句 -->
        <button @click="sub('sub success!')">-</button>
        <span>{{ count }}</span>
        <button v-on:click="add('add success!')">+</button>
    </div>

    <script src="./Vue2/vue.js"></script>

    <script>
        const app = new Vue({
            el: '#app',
            data: {
                count: 100
            },
            methods: {
                add(str) {
                    this.count++;
                    console.log('add', app.count, str);
                },

                sub(str) {
                    this.count--;
                    console.log('sub', app.count, str);
                }
            },
        })
    </script>
</body>
</html>
